/**
 * Project Name:lee
 * File Name:test.java
 * Package Name:com.lee.test
 * Date:2017年1月3日下午2:40:38
 * Copyright (c) 2017, chenzhou1025@126.com All Rights Reserved.
 *
 */

package com.lee.test;

import java.util.Date;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.activiti.engine.ProcessEngines;
import org.activiti.engine.repository.Deployment;
import org.junit.Test;

import com.lee.common.utils.Common;

/**
 * ClassName:test <br/>
 * Function: TODO ADD FUNCTION. <br/>
 * Reason: TODO ADD REASON. <br/>
 * Date: 2017年1月3日 下午2:40:38 <br/>
 * 
 * @author dell
 * @version
 * @since JDK 1.6
 * @see
 */
public class test {
	public static void main(String[] args) {
		/*String date = Common.fromDateH();
		System.out.println(date);*/
		String aa = "123456";
		String aString=aa.substring(0, 2);
		System.out.println(aString);
		System.out.println(aa.replace('2', '0'));
		StringBuffer stringBuffer =new StringBuffer(aa);
		System.out.println(stringBuffer.replace(0, 3, "2"));
		
	}

	@Test
	public void createTable() {
		ProcessEngine processEngine = ProcessEngineConfiguration.createProcessEngineConfigurationFromResource("activiti.cfg.xml").buildProcessEngine();
		System.out.println("processEngine" + processEngine);
	}

	// 部署流程定义
	@Test
	public void deploymentProcessDefinition() {
		ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
		Deployment deployment = processEngine.getRepositoryService() // 与流程定义和部署相关的service
				.createDeployment() // 创建一个部署对象
				.name("审批流程") // 添加部署的名称
				.addClasspathResource("bpmn/activiti.bpmn") // 加载资源，一次只能加载一个文件
				.addClasspathResource("bpmn/activiti.png").deploy();// 完成部署
		System.out.println("部署ID:" + deployment.getId());
		System.out.println("部署name:" + deployment.getName());
	}
}
